package com.lch.thread.juc;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * @author: liuchenhui
 * @create: 2019-05-18 20:09
 **/
public class ConditionNotify implements Runnable {

    private Lock lock;
    private Condition condition;

    public ConditionNotify(Lock lock, Condition condition) {
        this.lock = lock;
        this.condition = condition;
    }

    @Override
    public void run() {
        lock.lock();
        try {

            System.out.println("开始singnal");

            condition.signal();

            System.out.println("结束singnal");
        } finally {
            lock.unlock();
        }

    }
}
